package com.lnu.information.thread;

/**
 * @author : jian.zhang-2
 * @description:
 * @date : Create in 2:07 PM 2022/5/12
 * @modified By :
 */
public class YouHeThread extends Thread{
    String s;
    int millis;

    public YouHeThread(String s, int millis) {
        this.s = s;
        this.millis = millis;
    }
    public void run(){
        try {
            while (true) {
                System.out.println(s);
                System.out.flush();
                sleep(millis);
            }
        }catch (InterruptedException e){
            return;
        }
    }

    public static void main(String[] args) {
        YouHeThread t1 = new YouHeThread("你", 25);
        Thread t2 = new YouHeThread("他", 75);
        t1.start();
        t2.start();
    }

}
